package com.ai.bitcoin.jpa.dao;

import com.ai.bitcoin.jpa.entity.BccUserWeixinGroup;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface BccUserWeixinGroupDao extends JpaRepository<BccUserWeixinGroup, String> {

    @Query(value = "select * from bcc_user_weixin_group where nickname = ?1  and group_name = ?2", nativeQuery = true)
    BccUserWeixinGroup findByGroupNameAndNickname(String nickname, String groupname);

    /**
     * 查找唯一组
     *
     * @param groupName      群聊名称
     * @param groupOwnerName 群主
     * @return 组信息
     */
    BccUserWeixinGroup findByGroupNameAndGroupOwnerNameAndNickname(String groupName, String groupOwnerName, String nickName);

    void deleteByOpenId(String openId);
}
